import { CustomRequestOptions } from '@/interceptors/request'
import { miniProgramsRequest, appRequest } from '@/utils/request'

/* 获取精选商品列表  */
// export const getGoodsList = (data: Object) => {
//   return http.post<Object>('/applet/goods/list', { ...data })
// }

export async function getGoodsList({
  options,
  data,
}: {
  options?: CustomRequestOptions
  data: any
}) {
  // 隐藏错误提示
  // options.hideErrorToast = true;
  return miniProgramsRequest.request<IResData<any>>('/goods/list', {
    method: 'POST',
    ...(options || {}),
    data,
  })
}

export async function getGoodsDetail({
  options,
  data,
}: {
  options?: CustomRequestOptions
  data: any
}) {
  // 隐藏错误提示
  // options.hideErrorToast = true;
  return miniProgramsRequest.request<IResData<any>>('/goods/info', {
    method: 'POST',
    ...(options || {}),
    data,
  })
}

export async function getGoodsListLink({
  options,
  data,
}: {
  options?: CustomRequestOptions
  data: any
}) {
  // 隐藏错误提示
  // options.hideErrorToast = true;
  return miniProgramsRequest.request<IResData<any>>('/goods/promoter/link', {
    method: 'POST',
    ...(options || {}),
    data,
  })
}
